package io.github.betacatcode.learn.service;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;

@Configuration
public class MyUserDetailService {
    @Bean
    public UserDetailsService userDetailsService() {
        return new InMemoryUserDetailsManager(
                User.withUsername("user")
                        .password("$2a$10$XEL4P2ijkufp.Sjs3Z0td.9l/ggw8xbJFj4Y.5QSK/hpVPG9c8lZe")
                        .authorities("USER")
                        .build(),
                User.withUsername("admin")
                        .password("$2a$10$XEL4P2ijkufp.Sjs3Z0td.9l/ggw8xbJFj4Y.5QSK/hpVPG9c8lZe")
                        .authorities("USER","ADMIN")
                        .build()

        );
    }
}
